package com.sw.bbs.user.service;

import com.sw.bbs.common.common.ServiceException;
import com.sw.bbs.user.pojo.User;
import com.sw.bbs.user.vo.LoginRequest;
import com.sw.bbs.user.vo.RegisterRequest;
import com.sw.bbs.user.vo.SendCodeRequest;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

public interface UserService {

    /**
     * 登陆
     * @param loginRequest
     * @return token
     */
    Map loginBy(LoginRequest loginRequest) throws ServiceException;
    /**
     * 主册
     * @param registerRequest
     * @return token
     */
    Map registerBy(RegisterRequest registerRequest) throws ServiceException;

    /**
     * request获取用户登录信息
     * @param request
     * @return
     */
    User getUserByRequest(HttpServletRequest request) throws ServiceException;
    /**
     * tokenID获取用户User
     * @param token
     * @return
     */
    User getUserByToken(String token) throws ServiceException;

    /**
     * 发生验证码
     * @throws ServiceException
     */
    Integer sendCode(SendCodeRequest request) throws ServiceException;
}
